<template>
  <div class="category" @mouseover="mouseOver" @mouseleave="mouseLeave">
    <el-card
      class="card"
      :body-style="{ padding: '0px', width: '235px', height: '100%' }"
      :class="{
        shadow: showShadow,
      }"
      shadow="none"
    >
      <el-button
        plain
        class="button"
        type="info"
        @click="
          $router.push({
            path: '/home/moment',
            query: {
              urls: background,
            },
          })
        "
        >{{ themename }}</el-button
      >
      <el-carousel trigger="click" :autoplay="true" indicator-position="none">
        <el-carousel-item v-for="item in background" :key="item">
          <img :src="item" class="image" fit="fill" />
        </el-carousel-item>
      </el-carousel>
    </el-card>
  </div>
</template>

<script>
export default {
  props: {
    themename: {
      required: true,
      type: String,
      //[中文]
    },
    background: {
      required: true,
      type: Array,
    },
  },
  data() {
    return {
      showShadow: false,
      widthOfAvatar: 120,
    };
  },

  methods: {
    mouseOver() {
      this.showShadow = true;
    },
    mouseLeave() {
      this.showShadow = false;
    },
  },
};
</script>

<style   scoped>
.category {
  width: 237px;
  height: 283px;
  margin: 10px 10px;
}
.card {
  width: 100%;
  height: 100%;
}
.button {
  width: 100%;
  align-content: center;
  font-size: 20px;
  color: #999;
}

.image {
  width: 235px;
  height: 235px;
  display: block;
}
.shadow {
  box-shadow: 0px 5px 5px #4289a5 !important;
}
</style>
